#e
#Title[ԕuࣖv]
#Text[]
#PlayLevel[]
#Image[.\img\.png]
#BackGround[Default]
#BGM[\bgm\Rin's Theme.mp3]
#ScriptVersion[2]

script_enemy_main {
	let imgEnemy = GetCurrentScriptDirectory ~ "img\s_rin.png";
	#include_function ".\lib\lib_common.txt"

	@Initialize {
		SetMovePosition02(GetCenterX, GetClipMinY + 90, 60);
		SetLife(600);
		SetDamageRate(20,20);
		SetScore(300000);
		SetTimer(60);
		CutIn(KOUMA, "ԕuࣖv", "script\img\s_rin1.png", 129, 0, 256, 256);
		LoadGraphic(imgEnemy);
		SetTexture(imgEnemy);
		SetEnemyMarker(true);
		SetGraphicRect(1, 1, 34, 66);
		SetInvincibility(180);

		mainTask;
	}

	@MainLoop {
		SetCollisionA(GetX, GetY, 24);
		SetCollisionB(GetX, GetY, 24);
		yield;
	}

	@DrawLoop {
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		DrawGraphic(GetX, GetY);
	}

	@Finalize  {
		DeleteGraphic(imgEnemy);
	}

	task mainTask {
		loop(80) {yield;}

		loop
		{Concentration01(70);
		PlaySE(se_ch02);

		loop(70) {yield;}

		loop(50){loop(2){yield;}
		CreateShotA("shot", rand(GetClipMinX,GetClipMaxX), rand(GetClipMinY,GetClipMinY+180), 10);
		SetShotDataA("shot", 0, 0, 0, 0, 0, 0, GREEN04);
		PlaySE(se_kira00);
		SetShotKillTime("shot", 121);
		

		let angle2= rand(0,360/5);
		while(angle2<360){
		let shot1= 1;
		CreateShotA(shot1, 0, 0, 0);
		SetShotDataA(shot1, 0, 0, angle2, 0, 0.01, 1.5, WHITE12);

		AddShot(120, "shot", shot1, 0);
		angle2+= 360/5;
		}


		FireShot("shot");
		}

		loop(60) {yield;}
		SetMovePosition02(rand(GetCenterX -120,GetCenterX +120), rand(GetClipMinY +30,GetClipMinY +120), 90);

			let angle = rand(0, 360);
			let speed = 1;
			let a= 0;
			loop(5)
			{loop(24) {
			CreateShot01(GetX, GetY, speed, angle+a, YELLOW22, 0);
			PlaySE(se_tan00);
			angle += 360/24;

			}
			a+= 5;
			speed += 0.5;
			loop(20) {yield;}
			}
		
			loop(20) {yield;}

		}
	
	}
}
